package StudyCode.summary.Basic.mystring;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class StringDeleteSpaceAndWrap {

	public static void main(String[] args) {
		String str = "haha\r\nttt   lala \r\n";
		System.out.println("替换前:");
		System.out.println(str);
		System.out.println("替换后:");
		System.out.println(replace(str));
	}

	private static String replace(String str) {
		String dest = "";
		if (str != null) {
			Pattern p = Pattern.compile("\\s*|\t|\r|\n");
			Matcher m = p.matcher(str);
			dest = m.replaceAll("");
		}
		return dest;
	}
}
